﻿namespace GoodAdmin.Core;

/// <summary>
/// 框架实体基类Id
/// </summary>
public abstract class BaseEntityId
{
    /// <summary>
    /// 雪花Id
    /// </summary>
    [SugarColumn(ColumnDescription = "Id", IsPrimaryKey = true, IsIdentity = false)]
    public virtual long Id { get; set; }
}


/// <summary>
/// 框架实体基类自增Id
/// </summary>
public abstract class BaseIncrementId
{
    /// <summary>
    /// Id
    /// </summary>
    [SugarColumn(ColumnDescription = "Id", IsPrimaryKey = true, IsIdentity = true)]
    public virtual int Id { get; set; }
}



/// <summary>
/// 框架实体基类
/// </summary>
public abstract class BaseEntity : BaseEntityId
{
    /// <summary>
    /// 创建时间
    /// </summary>
    [SugarColumn(ColumnDescription = "创建时间", IsOnlyIgnoreUpdate = true, IsNullable = true)]
    public virtual DateTime? CreateTime { get; set; }

    /// <summary>
    /// 更新时间
    /// </summary>
    [SugarColumn(ColumnDescription = "更新时间", IsOnlyIgnoreInsert = true, IsNullable = true)]
    public virtual DateTime? UpdateTime { get; set; }

    /// <summary>
    /// 创建者Id
    /// </summary>
    [SugarColumn(ColumnDescription = "创建者Id", IsOnlyIgnoreUpdate = true, IsNullable = true)]
    public virtual long? CreateUserId { get; set; }

    /// <summary>
    /// 修改者Id
    /// </summary>
    [SugarColumn(ColumnDescription = "修改者Id", IsOnlyIgnoreInsert = true, IsNullable = true)]
    public virtual long? UpdateUserId { get; set; }

    /// <summary>
    /// 默认排序字段
    /// </summary>
    [SugarColumn(ColumnDescription = "默认排序字段", IsNullable = true, Length = 100)]
    public virtual string OrderField { get; set; } = SqlSugarConst.PrivateKey;
}
public abstract class BaseDataEntity : BaseEntity
{
    /// <summary>
    /// 创建组织Id
    /// </summary>
    [SugarColumn(ColumnDescription = "创建组织Id")]
    public virtual long? CreateOrgId { get; set; }
}

/// <summary>
/// 系统内置数据表默认entity
/// </summary>
public abstract class BaseSystemEntity: BaseEntity
{
    /// <summary>
    /// 系统标识字段
    /// </summary>
    [SugarColumn(ColumnDescription = "系统标识", Length = 20,IsNullable =true)]
    public virtual string SystemMark { get; set; }
}

/// <summary>
/// 框架实体基类：包含parentId
/// </summary>
public abstract class BaseEntityHasPid : BaseEntity
{
    /// <summary>
    /// ParentId
    /// </summary>
    [SugarColumn(ColumnName = "ParentId", ColumnDescription = "父节点id", IsNullable = true)]
    public virtual long ParentId { get; set; }
}

public abstract class BaseSystemEntityHasPid: BaseEntityHasPid
{
    /// <summary>
    /// 系统标识字段
    /// </summary>
    [SugarColumn(ColumnDescription = "系统标识", Length = 20, IsNullable = true)]
    public virtual string SystemMark { get; set; }
}

